Test Update#14
Open
maxpromer wants to merge 6427 commits into
Open
Conversation
|
The current version (before the incoming merge) has a bug while trying to compile ports/unix. I have to edit the code of the AXTLS library: -------------------------- ssl/os_port_micropython.h -------------------------- #define TTY_FLUSH() -#include "../../../extmod/crypto-algorithms/sha256.h" #define SHA256_CTX CRYAL_SHA256_CTX |
- This is necessary if the USB MSC device is exposing the SD Card, as a USB operation might read/write SD. - However, rather than disabling USB interrupts (and all lower interrupts) unconditionally, we can check if MSC is enabled & SDCard is configured as one of the USB MSC LUNs. This happens to be necessary to reliably trigger SDCard DMA alignment bugs from hard ISRs. However, it's good to do anyhow - allows interrupt processing to continue while the CPU is blocked waiting for the SD operation. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Rename the existing dma_alignment test to spi_dma_align, as this one uses the SPI driver. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Will avoid corruption for unaligned reads, unless a SPI DMA operation is in progress at the same time (to be fixed separately). This fixes the unit test added in the parent commit. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Has been the default forever (or, at least, for a decade) and was removed entirely in a recent esptool release. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit adds mode, pull, drive parameters to the Pin repr function. This allows to serialize Pin object to str and restore the Pin object from the string. Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
When waking from deep sleep, it could be helpful to know what pins triggered the wake up since the wake pins could be configured to multiple pins. Signed-off-by: Meir Armon <meirarmon@gmail.com>
A board can #define MICROPY_HW_SDMMC_LDO_CHAN_ID in mpconfigboard.h for an internal LDO to control power to the SDMMC GPIO pins. This is needed to use SDIO 3.0, because the IO level has to switch between 3.3V and 1.8V. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
The ESP32-P4-Function-EV-Board uses LDO 4 for controlling SDMMC GPIO power. This is required to use SD cards with this board. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Can now call machine.SDCard(ldo=...) to specify LDO channel. Channel defaults to MICROPY_HW_SDMMC_LDO_CHAN_ID if defined, otherwise None (disabled). Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Also enable MICROPY_PY_NETWORK_LAN if SOC_EMAC_SUPPORTED is defined, which enables on ESP32-P4. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Fixes #19035. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Prevent WiFi IP events from corrupting Ethernet status. Signed-off-by: Mo Nazemi <moh.nazemi@gmail.com>
To disable `machine.SoftI2C` set zero
#define MICROPY_PY_MACHINE_SOFTI2C (0)
in `ports/esp32/mpconfigport.h`.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
To disable `machine.SoftSPI` set zero in line
#define MICROPY_PY_MACHINE_SOFTSPI (0)
in file `ports/esp32/mpconfigport.h`.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
Fixes bug where SPI can freeze if another DMA channel is tranferring to/from PSRAM. Fixes issue #18471. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
This commit reduces the instruction count for the inline assembler sequence used in `mp_hal_ticks_cpu` when building the firmware in RISC-V mode. The code used a two instruction sequence to set the value of the `mcountinhibit` CSR to a fixed bit pattern, in order to have the cycle counter always enabled. Whilst this works, it also has the side-effect of always inhibiting the instructions counter, which may not be wanted in certain applications. Since all we need to do is to clear one bit, rather than setting the whole register we can just use the `CSRRCI` opcode to clear bit 0 of the CSR instead. This is done in a single instruction and leaves other register bits alone. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit reduces the instructions count for the bitstream module's time-critical function setup procedure, when the firmware is built for RISC-V. The original code used a separate function with three opcodes to make sure the hardware cycle counter is turned on. However, all of that could be condensed in a single opcode placed in lieu of the function call. An instance of the `CSRRCI` opcode is placed in the function opcode stream to clear bit 0 of the `mcountinhibit` CSR. `CSRRCI` is supposed to also store the original value of the CSR into a register, but luckily `zero`/`x0` is a valid target so the opcode can be placed safely without disrupting the existing registers' state. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This prevents Python code from accidentally performing an operation that resizes the buffer. However, in the case that the build excludes memoryview, the crash is still possible. Closes: #17848 Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit adds `.deinit()` to the `machine.I2C` class, bringing it in line with both the target I2C class variant and the rest of the peripheral classes. Ports that want to allocate I²C bus entries dynamically can implement the `self.deinit()` method to add deallocation/cleanup code, otherwise this method is entirely optional to have. If no method is found in the port-provided object structure then calling `deinit()` on the object will do nothing, following what the `machine.SPI` object does. This addresses #19096. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Without this, the register address is not copied into the single buffer, and so the requested register address is garbage when the driver reads it. Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
USB 2.0 requires high-speed capable devices to provide a Device Qualifier descriptor. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Refactor the byte length calculation in the wr_bytes and read methods to use a new `buffer_nbytes` function. This change corrects the accuracy of byte length determination for various buffer types. Closes: #17665 Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
This commit introduces an alias to access codeberg repos from within mpremote's package manager. Right now packages hosted on codeberg could only be referenced by their full URL, unlike other packages hosted on either GitHub or GitLab. To make access those packages easier, now they can be referenced as "codeberg:org/repo@branch". Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes it possible to disable the `dir` built-in function from being included in the interpreter image. The function in question is rarely used outside of interactive contexts, and in production code the main use of this function is to implement interactive debug/management consoles over a serial port. However, outside of that scope, the space taken by such function could probably be better used elsewhere. This feature inherits the same configuration level as `enumerate`, since it performs the same operation but on class members rather than data elements. This should be enabled by default on all ports except for `nrf` (for which it is now explicitly enabled) and the `minimal` variants of the `unix` and `zephyr` ports. The latter two ports are meant to also run with the smallest available feature set, so `tests/basics/builtin_dir.py` had to be made optional to make CI run cleanly for those two ports' test runs in their minimal configuration. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Ths fixes the following type of diagnostic: "runtime error: left shift of 14 by 28 places cannot be represented in type 'int'" and ensures the resulting 32-bit value is correct. Signed-off-by: Jeff Epler <jepler@gmail.com>
This fixes the diagnostic "runtime error: left shift of negative value -1" and ensures the correct instruction is assembled. Signed-off-by: Jeff Epler <jepler@gmail.com>
The existing entry covered ``range(-maxsize - 1, 0)`` (negative side) but not the symmetric positive case raised in #17026, where ``range(sys.maxsize + 1, sys.maxsize + 2)`` raises OverflowError in MicroPython while CPython accepts arbitrary integer arguments. Add that example and update the description/cause so it is clearer that the limitation is on the magnitude of the individual arguments (they must fit in mp_int_t), not just on the size of the resulting range. ``tools/gen-cpydiff.py`` will regenerate the rendered table from this file. Fixes #17026. Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
This was missing, and is easy to enable. Signed-off-by: Damien George <damien@micropython.org>
Try to find the best prescaler/period combination that still fits within a 16-bit prescaler value, by making sure that the prescaler does not overflow. As a last resort, set the prescaler to its maximum value and recalculate the period based on that. If that doesn't work then the requested frequency is too low, so raise an appropriate exception. Signed-off-by: Damien George <damien@micropython.org>
This generalises the peripheral construction test so that it works on PYBV1x, PYBLITEV10 and PYBD_SFx boards. Also makes it use unittest. Signed-off-by: Damien George <damien@micropython.org>
These tests were originally written for PYBV1x and PYBLITEV10, and then adapted to PYBD_SFx and then further to NUCLEO_WB55. This commit adapts them even further to pass on: - NUCLEO_G0B1RE - NUCLEO_H723ZG - NUCLEO_L152RE - OPENMV_N6 Signed-off-by: Damien George <damien@micropython.org>
The native emitter cannot generate code for "raise" (re-raising) or "raise x from y" (exception chaining). Trying to generate such code can happen in normal programs, so raise an NotImplementedError instead of using an assert (that won't even be enabled in most production builds). And add a coverage test for this new exception. Signed-off-by: Damien George <damien@micropython.org>
This allows these tests to run with the native emitter. The only remaining raise-with-0-args are in tests than specifically check this re-raise behaviour. Signed-off-by: Damien George <damien@micropython.org>
This commit updates `extmod/ssl_keycert` and `extmod/tls_sslcontext_ciphers` tests to also pass even if the interpreter was built with terse error messages. Originally the tests assumed the error messages level was always higher than `MICROPY_ERROR_REPORTING_TERSE`, and thus expected a particular string pattern to appear in certain errors' output. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit updates the list of tests to skip if the error message level is less or equal to "terse", adding `cmdline/repl_paste`, `extmod/vfs_blockdev_invalid`, and `misc/sys_settrace_features`. In situations where space is at a premium usually the REPL isn't enabled. If it is, changes to REPL internals are usually also covered by other tests. Leaving `cmdline/repl_paste` out in this case is an acceptable compromise, and can be manually tested if it is really needed. On the other hand, `extmod/vfs_blockdev_invalid` is temporarily put in the skip list due to the kind of changes needed to make it work in the scenario tested here. Whilst the amount of changes isn't staggering, it may require migrating the test over to `unittest`, which is probably better left to a separate commit for another time. Finally, `sys.settrace`'s output varies depending on what the code actually does, and changing the way error messages are built and reported does impact on the final test output. This means that to keep the test being executed during regular CI jobs, the test could either be split into two separate files, one per error detail level, or the test runner be modified to match the expected output with different files depending on the error detail level. Regular expressions here won't help, as changes involve block of lines rather than parts of a single line at a time. The best compromise here is to skip this test unless there is one single source of truth when it comes to expected output. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds a new CI target for the Unix port, which is the `standard` variant being built with terse error messages. Even though it won't cover all possible tests failing with terse error messages (some occur only in the `coverage` build variant), this should be a good start for preventing new tests to not assume a particular error message level. To make things automated, the new target is also added to the regular CI jobs set in the Unix port's GitHub workflow file. This closes #17707. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Add the following new PATHS: * drivers/**/*.[ch] * examples/**/*.[ch] * shared/libc/*.[ch] Add an exclusion for "drivers/cc3100/*/*.[ch]". Add an exclusion for "shared/readline/*.[ch]". Update "extmod/nimble" path to include "**". Signed-off-by: Phil Howard <phil@gadgetoid.com>
Avoid getting fancy with MICROPY_MALLOC_USES_ALLOCATED_SIZE and make the function calls with/without this define explicit and readable. Signed-off-by: Phil Howard <github@gadgetoid.com>
Run code formatting to apply rules to: * drivers/**/*.[ch] * examples/**/*.[ch] * extmod/nimble/**/*.[ch] * shared/libc/*.[ch] Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Damien George <damien@micropython.org>
This commit updates the `make-memzip.py` utility to finish the migration to Python 3.x. The code still wasn't fully aware of how Python unified bytes and strings when it comes to I/O API. These changes help with that. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes the `make-memzip.py` utility more resilient in certain usage cases, which weren't accounted for in the original source. In some Linux distributions the `zip` command may not be available, although `unzip` could be. Unless the `zip` package is installed this script will fail with a generic "file not found" error, which has been addressed in these changes set. Also, the `zip` command by default adds a `.zip` suffix to archives, which wasn't accounted for. So, running `./make-memzip -z z1 -c z2 .` would fail, as the script would build `z1.zip` whilst the header generator attempted to open `z1` instead. This has now been fixed. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit modifies the native modules build system to use different
directories for different architectures.
Previously, the natmod build system would unconditionally put all build
data into a single directory (usually "$(PWD)/build" unless overridden),
and the static library runtime cache into another directory
("$(PWD)/.mpy_ld_cache"). That works if building is always done for a
single architecture or if a full clean is performed before switching
architectures, which sometimes is not wanted (collecting the runtime
cache may take quite some time depending on the module complexity, for
example).
With these changes, both the build directory and the runtime cache
directories are marked with the name of the architecture they target, so
for example "$(PWD)/build" becomes "$(PWD)/build_x64" (the same happens
to the cache directory name).
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes a minor change to the native module build scripts, to make the intermediate MPY file keep the same file name it will have once the final pre-processing step takes place. A MPY file will retain its file name as the first QSTR entry in the file, and before these changes the name being written would be the one used for the intermediate MPY output file (ie. "$BUILDDIR/$MODNAME.native.mpy"). The `mpy-tool.py` preprocessing pass would keep that string intact but rename the file, so things wouldn't match in error tracebacks. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds an option to the MPY linker to brand generated file with a custom internal file name rather than the raw output path provided in the command line. MPY files, as part of their preambles, will contain a path name as the first entry in the constant string pool. However that may contain unneeded data (ie. sometimes the plain file name is enough) or it may have sensitive data in there (if an alternate build path is provided it may contain product code names or client names which should probably not be disclosed). Until now there was no provision to let users use a different internal path name. A new option was added to `mpy_ld.py`: "--source-name" which, if passed, will write the given string in the module file. If said option is not provided, generated MPY files will still carry the raw command line output path but stripped of all leading path segments. The example natmod makefiles have been updated to always provide that option whenever the final file name on the filesystem wouldn't match the internal MPY file name. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
MICROPY_PY_LWIP_PPP is used in only one place and is generally set to
the value of MICROPY_PY_NETWORK_PPP_LWIP. Remove the former.
extmod/lwip-include/lwipopts_common.h: Replace MICROPY_PY_LWIP_PPP
with MICROPY_PY_NETWORK_PPP_LWIP.
ports/mimxrt/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP.
ports/rp2/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP,
default MICROPY_PY_NETWORK_PPP_LWIP to
MICROPY_PY_LWIP.
ports/stm32/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP.
Signed-off-by: Phil Howard <github@gadgetoid.com>
mpconfigport.h: Default MICROPY_PY_NETWORK_PPP_LWIP to 1. Signed-off-by: Phil Howard <github@gadgetoid.com>
This updates the PATHS to include: - everything under `extmod/` - everything under `py/` (in case one day there are subdirs there...) - everything under `shared/` This makes sure that any C source files added anywhere under these directories will be formatted. Signed-off-by: Damien George <damien@micropython.org>
These need to be formatted due to the parent commit. Signed-off-by: Damien George <damien@micropython.org>
This reverts commit 6552836. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This seems like it's only really a problem on Debug builds, but I think can't hurt to increase it on all windows builds. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This removes the last usage of mp_binary_set_val_array_from_int(). It will be a little slower, but shouldn't be measurably so compared to the ADC sampling. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
If >1 unittest-enabled module is included, the results of the merged module won't match (as it runs some previously registered tests again). Signed-off-by: Angus Gratton <angus@redyak.com.au>
This PR was originally a cherry-pick of CircuitPython commits 095c844, d103ac1, c592bd6 and 8664a65. However, substantial additional changes so the implementation has diverged a lot from CircuitPython's: - Keep CPython >= 3.11 defaults for int.to_bytes(), consistent with 80c5e76 and 0b432b3. - Refactors to reduce the code size impact of this change. Various code paths are now funneled into new function mp_obj_int_to_bytes() and existing function mp_binary_set_int(), except where a simple assignment is used for performance reasons (i.e. array, moductypes). - Keep the MicroPython behaviour of not overflow checking assignments to arrays, bytearrays, etc. - but enable overflow checks as part of MicroPython V2.0. - Update tests to work with the new behaviour (similar to CPython) and add coverage for new code and some corner cases. Some tests are converted to unittest so we can easily verify both current and V2.0 overflow. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Generated `qstr.i.last` files (output from the "pp" phase) can be very large due to inclusion of large HAL headers. Yet only a small amount of this data is actually needed by the "split" phase of `makeqstrdefs.py`. This commit improves the situation by filtering out unneeded lines as early as possible: in the "pp" phase the C preprocessor runs, its output is parsed via a pipe connection, and only those lines that are needed are written out to the `qstr.i.last` file. When the "split" phase runs it then sees only the necessary lines (it does further regex filtering to get exactly the lines it needs for the given mode). Windows already does this filtering (it does not use `makeqstrdefs.py` for the preprocessor phase) in its `ConcatPreProcFiles` function, and that was added long ago in 29c8c8a. This change significantly reduces the output build size and improves the build speed: - stm32 BOARD=PYBV10: build output goes from 152M down to 32M, and build is 10% faster (29s down to 26s). Building all stm32 boards, the total build size goes from about 11GB down to about 2.5GB. - rp2 BOARD=RPI_PICO: build output goes from 87M down to 39M, and build is about 5% faster (23s down to 21.6s). - esp32 BOARD=ESP32_GENERIC: build output goes from 307M down to 230M, and build is about 6% faster (101s down to 95s). Tested all three ports above, that the files in build/genhdr are equivalent (except of course `qstr.i.last`), and that PYBV10 is binary equivalent before and after this change. Signed-off-by: Damien George <damien@micropython.org>
This adds a new `--trace-output` option to `run-tests.py` which mimics the same option already in `run-multitests.py`. Using it, the output from the test running on a board is printed to stdout as it is received. This allows easier debugging of tests, to see the output in real time. For tests that have complicated run parameters, eg using via-mpy or needing a target wiring script, running them standalone (eg with `mpremote`) is not possible, so using `run-tests.py` becomes mandatory, hence the need to easily see the output without having to view the result file separately at the end. It's also useful to watch tests that pass but are long running. Signed-off-by: Damien George <damien@micropython.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.